<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a="http://topnet.it/facelets"
	xmlns:fn="http://topnet.it/functions"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
	xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">

<ui:composition template="/WEB-INF/layout/t_single.xhtml">
	<ui:define name="title">Gestione Contratto</ui:define>
	<ui:define name="content">
		<h2>Gestione Contratto</h2>
		<h:form id="form">
			<rich:panel id="prenotazioneScooter">
				<a4j:region id="r1toa2">
					<rich:messages />
					<h:panelGrid columns="2">

						<a:field id="scooter" label="Cilindrata(*):" type="selOneM"
							entityId="#{contrattiHandler.contratto.scooter}" fieldName="id"
							entityList="#{scootersHandler}" fieldNameList="scootersItems"
							required="true" />


						<a:field id="dataInit" label="Data Inizio(*):"
							fieldName="dataInit" type="dateTime"
							entity="#{contrattiHandler.contratto}" required="true"
							datePattern="d/M/yy HH:mm" />

						<a:field id="dataEnd" label="Data Riconsegna(*):"
							fieldName="dataEnd" type="dateTime"
							entity="#{contrattiHandler.contratto}" required="true" />

					</h:panelGrid>
				</a4j:region>
				<h:panelGrid columns="2">

					<a4j:commandButton id="calculateSum"
						action="#{contrattiHandler.calcolaSomma}" value="calcola prezzo"
						reRender="sommaPanel" immediate="false" />
				</h:panelGrid>
			</rich:panel>

			<rich:panel id="sommaPanel">
				<f:facet name="header">
					<h:outputText value="Scooter disponibili" />
				</f:facet>
				<h:panelGrid columns="2">
					
				</h:panelGrid>
			</rich:panel>

			<rich:spacer height="30" />
			<div><h:commandButton id="submitAdd"
				action="#{contrattiHandler.addContratto2}"
				value="Crea Nuovo Contratto"
				rendered="#{not contrattiHandler.editMode}" /> <h:commandButton
				id="exit" action="/contratti/" value="Esci" /> <h:commandButton
				id="delUpdate" action="#{contrattiHandler.delContratto}"
				value="Elimina" rendered="#{contrattiHandler.editMode}" /></div>
		</h:form>
	</ui:define>
</ui:composition>
</html>